import React, { Component } from 'react'

import  {userlist} from  "../interface/user"

export default class User extends Component<any,any> {

    constructor(props:any){
        super(props);
        this.state = {
            list:[]
        }

    }
  async  componentDidMount(){
      let  {data} = await userlist({});
      this.setState({
          list:data.list
      })

    }
  render() {
    return (
      <div>

          <div className='table'>
              <div className='tr'>
                  <div className='item'>编号</div>
                  <div className='item'>用户名</div>
                  <div className='item'>密码</div>
                  <div className='item'>操作</div>
              </div>
              {this.state.list.map((item:any)=>{
                  return   <div className='tr' key={item._id}>
                  <div className='item'>{item._id}</div>
                  <div className='item'>{item.username}</div>
                  <div className='item'>{item.userpwd}</div>
                  <div className='item'>删除</div>
              </div>
              })}
          </div>
      </div>
    )
  }
}
